Reset Cirrus device model `VRAM' whenever a VGA/SVGA mode switch occurs.
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 10 May 2006 15:05:24 +0000 (16:05 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 10 May 2006 15:05:24 +0000 (16:05 +0100)
If you change the video resolution on a Windows XP guest such that it uses
fewer bytes of VRAM (either by using fewer bytes per pixel or by lowering the
resolution) then some window backgrounds will become corrupted.  This happens
because the Windows XP Cirrus Logic driver assumes that VRAM is initialized
to 0xff whenever the video mode switches between VGA and SVGA.

Signed-off-by: Donald.D.Dugger@intel.com
tools/ioemu/hw/cirrus_vga.c

index 2786c3fae7250f0e63dd302dfd0ebbb0fdeda1db..fda80427718f580fa3e94244e0fd4d571a4cc653 100644 (file)
@@ -1187,6 +1187,17 @@ cirrus_hook_write_sr(CirrusVGAState * s, unsigned reg_index, int reg_value)
        s->hw_cursor_y = (reg_value << 3) | (reg_index >> 5);
        break;
     case 0x07:                 // Extended Sequencer Mode
+       /* Win2K seems to assume that the VRAM is set to 0xff
+        *   whenever VGA/SVGA mode changes 
+        */
+       if ((s->sr[0x07] ^ reg_value) & CIRRUS_SR7_BPP_SVGA)
+           memset(s->vram_ptr, 0xff, s->real_vram_size);
+       s->sr[0x07] = reg_value;
+#ifdef DEBUG_CIRRUS 
+       printf("cirrus: handled outport sr_index %02x, sr_value %02x\n",
+              reg_index, reg_value);
+#endif
+       break;
     case 0x08:                 // EEPROM Control
     case 0x09:                 // Scratch Register 0
     case 0x0a:                 // Scratch Register 1
@@ -3021,10 +3032,6 @@ static void cirrus_init_common(CirrusVGAState * s, int device_id, int is_pci)
     }
     s->cr[0x27] = device_id;
 
-    /* Win2K seems to assume that the pattern buffer is at 0xff
-       initially ! */
-    memset(s->vram_ptr, 0xff, s->real_vram_size);
-
     s->cirrus_hidden_dac_lockindex = 5;
     s->cirrus_hidden_dac_data = 0;